home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
NewObject.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
2KB
|
76 lines
#include "stdafx.h"
#include "NewObject.h"
static int new_object = 0, make_related = FALSE;
CNewObject::CNewObject(CWnd* pParent)
: CDialog(CNewObject::IDD, pParent)
{
//{{AFX_DATA_INIT(CNewObject)
//}}AFX_DATA_INIT
}
void CNewObject::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CNewObject)
DDX_Control(pDX, IDC_NEWOBJECT_RELATING, m_Relating);
DDX_Control(pDX, IDC_NEWOBJECT_LIST, m_List);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CNewObject, CDialog)
//{{AFX_MSG_MAP(CNewObject)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CNewObject::OnInitDialog()
{
CDialog::OnInitDialog();
for (cProperties *p = props; p != 0; p = (cProperties *)p->next)
if (p->objtype != 0)
{
int i = m_List.AddString(construct("%s (%s)", p->name, p->type));
m_List.SetItemDataPtr(i, p);
}
m_List.SetCurSel(new_object);
m_Relating.SetCheck(make_related);
return TRUE;
}
void CNewObject::OnOK()
{
new_object = m_List.GetCurSel();
make_related = m_Relating.GetCheck();
// Make object
cProperties *p = (cProperties *)m_List.GetItemDataPtr(new_object);
cSurface *s = *p->objtype->surface;
cObjectTypes::make(GAME_DX / 2, s->start + GAME_DY / 2, p, make_related);
// Create new editables
cEditable::make_editables();
// Make document dirty
gamewindow->GetDocument()->SetModifiedFlag();
// Make sure it is drawn
s->all_dirty();
gamewindow->Invalidate();
// Call base class
CDialog::OnOK();
}